package com.wlr.study.leetcode;

public class LeetCode35 {
    public int searchInsert(int[] nums, int target) {
        int i = 0, j = nums.length - 1, n = nums.length;
        while(i<=j){
            int mid = ((j-i)>>1)+i;
            if(target<=nums[mid]){
                n=mid;
                j=mid-1;
            }else{
                i=mid+1;
            }
        }
        return n;
    }
}
